STEP 7: We can see our player on the stage now, but we need to return the sprite from add_player() in order to use the sprite in our main() function.

The return statement passes a variable from a function back to where the function is called.

  • Click on LOGIC. Go to and drag Return Statement to the last line of add_player().
  • Change the variable being returned from my_var to player. Make sure this return statement is indented!

To navigate the page using the TAB key, first press ESC to exit the code editor.

def set_stage(): """ Sets up the stage for the game """ stage.set_background("soccerfield") stage.disable_floor() def add_player(): """ Adds a player to the stage for the user to control """ player = codesters.Sprite("player1") player.go_to(0, -155) def main(): """ Sets up the program and calls other functions """ set_stage() player = add_player() main()
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)